<!DOCTYPE html>
<script src="/js-test-resources/js-test.js"></script>
<script>
jsTestIsAsync = true;

var xhr = new XMLHttpRequest();
xhr.responseType = 'document';
xhr.onreadystatechange = function () {
    if (this.readyState != XMLHttpRequest.DONE) {
        // avoid showing PASS messages via shouldBeNull, as we have no guarantee how many 'readystatechange' we would receive.
        if (xhr.responseXML !== null)
            testFailed("response HTML was visible before DONE")
        return;
    }

    shouldBeNonNull("xhr.responseXML");
    testRunner.notifyDone();
}

xhr.open("GET", "resources/small-chunks.cgi", true);
xhr.send(null);
</script>
